<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2010 Google Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:exsl="http://exslt.org/common"
  xmlns:str="http://exslt.org/strings"
  version="1.0"
  exclude-result-prefixes="exsl str">

  <!-- Copyright 2010 Google Inc. All Rights Reserved -->
  <!-- Author jacoby@google.com (Jacoby Thwaites) -->

  <xsl:output method="xml" />

  <xsl:variable name="title" select="'Event Switch'" />
  <xsl:variable name="theme" select="'txm'" />

  <!--  Common HTML wrapper lays out panels -->
  <xsl:template match="/">
    <html>
      <!-- Client-side transformer implementation info -->
      <xsl:comment>
        <xsl:text>&#x0A;xsl:vendor: </xsl:text>
        <xsl:value-of select="system-property('xsl:vendor')"/>
        <xsl:text>&#x0A;xsl:vendor-url: </xsl:text>
        <xsl:value-of select="system-property('xsl:vendor-url')"/>
        <xsl:text>&#x0A;xsl:version: </xsl:text>
        <xsl:value-of select="system-property('xsl:version')"/>
        <xsl:text>&#x0A;exsl:node-set: </xsl:text>
        <xsl:value-of select="function-available('exsl:node-set')"/>
      </xsl:comment>

      <head>
        <title>
          <xsl:value-of select="$title" />
        </title>
        <link rel="stylesheet" type="text/css" href="../inlay.css" />
        <link rel="stylesheet" type="text/css" href="../txm.css" />
        <script type="text/javascript" src="../jquery-1.4.2.js" />
        <script type="text/javascript" src="../common.js" />

        <!-- Generate view-specific styles or other head content -->
        <xsl:apply-templates mode="head"/>

      </head>
      <body class="{$theme}" id="body">
        <div class="g-doc">
          <div class="header">
            <div class="logo" />
            <div class="block" />

            <!-- Generate view-specific nav -->
            <xsl:apply-templates mode="horizontal-nav" />
          </div>

          <!--
            Nav-specific left panel.
            We add the g-collapsed class to this to activate the css
            g-collapsed rules in descendant elements.
          -->
          <div class="g-section g-tpl-210" id="collapse-group">

            <!-- Left Panel -->
            <div class="g-unit g-first g-sidenav">

              <!-- Collapse/expand -->
              <a class="g-sidenav-collapse" behaviour="collapse">
                <xsl:text>«</xsl:text>
              </a>
              <a class="g-sidenav-expand" behaviour="expand">
                <xsl:text>»</xsl:text>
              </a>

              <!-- Left panel holds index or other stuff depending on tab -->
              <xsl:apply-templates mode="leftPanel" />

              <!-- Help is at bottom in all tabs -->
              <div class="g-box g-box-secondary">
                <h2>Help</h2>
                <hr />
                <div class="g-helplinks">
                  <!-- Each tab can decide what help links to show -->
                  <xsl:apply-templates mode="help-links"/>
                </div>
                <hr />
                <input type="search" placeholder="Search help"
                  style="width:140px;" />
                <button>Go</button>
              </div>
            </div>

            <!--  Nav-specific main panel -->
            <div class="g-unit g-content">
                <xsl:apply-templates mode="main-panel" />
            </div>
          </div>

          <!-- Footer incorporating hidden data island holding source XML -->
          <div id="footer-panel">
            <xsl:apply-templates mode="footerPanel" />
            <div class="small">
              Copyright 2010 Google Inc. All Rights Reserved
            </div>

            <div style="display:none;" id="source">
              <xsl:copy-of select="/" />
            </div>
          </div>
        </div>

        <!-- Modal mask (see css for style states) -->
        <div class="modal-mask"/>

        <!-- Generate view-specific modals (must come after the mask) -->
        <xsl:apply-templates mode="modal-dialogs"/>
      </body>
    </html>
  </xsl:template>

  <!--  Common error rendering -->
  <xsl:template match="error[@error]">
    <div class="error">
      Error return:
      <xsl:value-of select="@error" />
    </div>
  </xsl:template>

  <!--  Common exit rendering (normally means a server process crash) -->
  <xsl:template match="error[@exit]">
    <div class="error">
      Server process exit:
      <xsl:value-of select="@exit" />
    </div>
  </xsl:template>
</xsl:stylesheet>
